From a96c5864509b175d1120e467774343fad8d96769 Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Fri, 24 Feb 2017 22:46:05 +0000 Subject: [PATCH] =?utf8?q?ScrolledWindow:=20Don=E2=80=99t=20req=20size=20f?= =?utf8?q?or=20autohidden=20bars?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit POLICY_AUTOMATIC means scrollbars are only shown when needed, i.e. when the size of the window is not large enough to show the entire child. So when measuring the preferred size, such scrollbars should be ignored. But measure() added size for *any* non-overlay scrollbar of the opposite orientation, e.g. for horizontal size, it added the width of vscrollbar. So we requested for child + bar, & having enough for child meant that the policy hid the bar, leaving extra space empty below/right of the child. Fix this by only adding size for such bars if they use POLICY_ALWAYS. https://bugzilla.gnome.org/show_bug.cgi?id=778853 --- gtk/gtkscrolledwindow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 1b09478d49..1a22923313 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1765,7 +1765,7 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget, minimum_req = MAX (minimum_req, hscrollbar_requisition.width + sborder.left + sborder.right); natural_req = MAX (natural_req, hscrollbar_requisition.width + sborder.left + sborder.right); } - else if (!priv->use_indicators) + else if (!priv->use_indicators && priv->hscrollbar_policy == GTK_POLICY_ALWAYS) { minimum_req += hscrollbar_requisition.height; natural_req += hscrollbar_requisition.height; @@ -1782,7 +1782,7 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget, minimum_req = MAX (minimum_req, vscrollbar_requisition.height + sborder.top + sborder.bottom); natural_req = MAX (natural_req, vscrollbar_requisition.height + sborder.top + sborder.bottom); } - else if (!priv->use_indicators) + else if (!priv->use_indicators && priv->vscrollbar_policy == GTK_POLICY_ALWAYS) { minimum_req += vscrollbar_requisition.width; natural_req += vscrollbar_requisition.width; -- 2.30.2